import { _decorator, Component, Node, UITransform, Sprite, Animation, SpriteFrame, AnimationClip, animation } from 'cc'
const { ccclass, property } = _decorator

// 状态
import State from './State'
import { StateMchine } from './StateMchine'


// 子状态机
export abstract class SubStateMchine {
   // 当前状态
   private _currentState: State | null = null
   // 状态机
   stateMachines: Map<string, State> = new Map()

  // 状态机
  fsm: StateMchine | null = null

  constructor(fsm: StateMchine) {
    this.fsm = fsm
  }

  get currentState() {
    return this._currentState
  }

  set currentState(newState: State) {
    this._currentState = newState
    this._currentState.run() //播放动画
  }

  abstract run(): void
}
